from typing import Dict, List, Tuple, Any
from enum import Enum
import sys
import os
import re
import logging as l
import random
from tools import *
from types import *
import json
from models import *
# 自己的模块
from migrate_strategy import Strategy



if __name__ == '__main__':
    debug = False
    parameter_best = parameter(9, 9, 80, 40, 9, 9, 76, 46, 0.06, 0.17)
    if os.path.exists('../../../data/training-1.txt'):
        debug = True

    set_up_log(debug)
    if debug:
        op_list, server_type_list, vm_type_dict = read_data_z_edition(open('../../../data/training-2.txt'))
        solution = Strategy(op_list, vm_type_dict, server_type_list,parameter_best)
        result = Output(open('output2.txt','w'))
        solution.run(result)
        result.output()
        l.info('total machine: %d' % (len(solution.server_list)))
    else:
        op_list, server_type_list, vm_type_dict = read_data_z_edition()
        solution = Strategy(op_list, vm_type_dict, server_type_list,parameter_best)
        result = Output(sys.stdout)
        solution.run(result)
        result.output()
